const express = require('express')
const app = express()
const path = require('path')
const cors = require('cors')
const router = require('./router.js')
//解决跨域的中间件
app.use(cors())
//开放public接口
app.use('/public',express.static(path.join(__dirname,'./public')))
//默认请求路径
app.use('/',express.static(path.join(__dirname,'./view')))
app.use('/api',router)
app.listen(3000,()=>{
  console.log('http://localhost:3000')
})